<div class="clearfix">
	<div class="row-fluid">
		<div class="span9">
			<form id="searchForm" method="post" action="#">
				<div class="control-group" id="searchBar" >
					<input type="hidden" name="searchPar" value="0"/>
					<input type="hidden" name="activePage" id="activePageBar"/>	
						<?php
							if (is_array($searchBar)){
								$j=0;						    	
						    	foreach ($searchBar['pFieldName'] as $pFieldName){
						    		if ($j==0){
						    			echo '<div class="controls"><select class="span3" name="fieldName[]">';
										$i = 0;
										foreach ($searchBar['fieldnames'] as $field){
											if ($field['value'] == $pFieldName){
												echo '<option value="'.$field['value'].'" selected="selected">'.$field['label'].'</option>';
											} else {
												echo '<option value="'.$field['value'].'">'.$field['label'].'</option>';
											}	
										}
										echo '</select> ';
										
										echo '<select class="span2" name="condition[]">';
										if ($searchBar['pCondition'][$i] == "LIKE"){
											echo '<option value="LIKE" selected="selected">LIKE</option>
												  <option value="EQUAL">=</option>
												  <option value="NOT_EQUAL">!=</option>';
										}
										if ($searchBar['pCondition'][$i] == "EQUAL"){
											echo '<option value="LIKE" >LIKE</option>
												  <option value="EQUAL" selected="selected">=</option>
												  <option value="NOT_EQUAL">!=</option>';
										}
										if ($searchBar['pCondition'][$i] == "NOT_EQUAL"){
											echo '<option value="LIKE" >LIKE</option>
												  <option value="EQUAL" >=</option>
												  <option value="NOT_EQUAL" selected="selected">!=</option>';
										}																		
										echo '</select> ';
										echo '<input type="text" class="span4" name="fieldValue[]" value="'.$searchBar['pFieldValue'][$i].'" id="defaultSearchField"/> ';
										echo '<a class="btn green" style="padding: 5px 12px;vertical-align: top" onClick="addSearchKey(event)"><i class="icon-plus m-icon-white"></i></a>
											  <a class="btn green" style="padding: 5px 12px;vertical-align: top" onClick="submitSearch(event)"><i class="icon-search m-icon-white"></i></a>
											  <a class="btn green" style="padding: 5px 12px;vertical-align: top" href="'.base_url().'"><i class="icon-refresh m-icon-white"></i></a></div>';	
										
										$j=1;		
						    		} else {
						    			echo '<div class="controls"><select class="span3" name="fieldName[]">';
										foreach ($searchBar['fieldnames'] as $field){
											if ($field['value'] == $pFieldName){
												echo '<option value="'.$field['value'].'" selected="selected">'.$field['label'].'</option>';
											} else {
												echo '<option value="'.$field['value'].'">'.$field['label'].'</option>';
											}	
										}
										echo '</select> ';
										
										echo '<select class="span2" name="condition[]">';
										if ($searchBar['pCondition'][$i] == "LIKE"){
											echo '<option value="LIKE" selected="selected">LIKE</option>
												  <option value="EQUAL">=</option>
												  <option value="NOT_EQUAL">!=</option>';
										}
										if ($searchBar['pCondition'][$i] == "EQUAL"){
											echo '<option value="LIKE" >LIKE</option>
												  <option value="EQUAL" selected="selected">=</option>
												  <option value="NOT_EQUAL">!=</option>';
										}
										if ($searchBar['pCondition'][$i] == "NOT_EQUAL"){
											echo '<option value="LIKE" >LIKE</option>
												  <option value="EQUAL" >=</option>
												  <option value="NOT_EQUAL" selected="selected">!=</option>';
										}																		
										echo '</select> ';
										echo '<input type="text" class="span4" name="fieldValue[]" value="'.$searchBar['pFieldValue'][$i].'"/> ';
										echo '<a class="btn red" style="padding: 5px 12px;vertical-align: top" onClick="delSearchKey(event, this)"><i class="icon-remove m-icon-white"></i></a></div>';
						    		}		
						    		$i++;							    		
						    	}
						    }
						?>														
				</div>
			</form>
		</div>
		<div class="span3">
			<div class="dataTables_filter">
				<label>
					<select name="sample_1_length" size="1" aria-controls="sample_1" class="m-wrap xsmall">
						<option value="10">10</option>
						<option value="25">20</option>
						<option value="50">50</option>
						<!--<option value="-1">All</option>-->
					</select> records per page </label>
			</div>
		</div>
	</div>
</div>

<!--	<input type="hidden" name="searchPage" id="searchPage"/>-->
